#include "nr_device_server.h"
#include "nr_device_export.h"

#define NR_DEVICE_TYPE_ID_SERVER 000

nr_error_t nr_create_device(nr_id_t device_type_id, void **p_device)
{
    // Only support the server device here
    Q_ASSERT(p_device);
    if (device_type_id == NR_DEVICE_TYPE_ID_SERVER)
    {
        nr_device_server* server = new nr_device_server;
        *p_device = server;

        return NR_ERROR_NONE;
    }
    else
        return NR_ERROR_NOT_SUPPORT;
}

nr_error_t nr_free_device(void *device)
{
    if(device == NULL)
        return NR_ERROR_NOT_VALID_PARAMETER;
    
    nr_device_server* server = (nr_device_server*)device;
    delete server;
    
    return NR_ERROR_NONE;
}